// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

cc.Class({
    extends: cc.Component,

    properties: {
        myAlert:cc.Prefab
    },
    
    onLoad() {
        console.log("home页面的")

               //预制体创建出来，并没有指定父节点
      this.myAlert = cc.instantiate(this.myAlert)
      //this.myAlert.parent = this.node
      this.node.addChild(this.myAlert)
      this.myAlert.Y = 20
      this.myAlert.X = 30
      this.myAlert.W = 100
      this.myAlert.H = 100
      this.myAlert.active = false
    },

    start() {

    },
    alertAction () {
        this.myAlert.active = !this.myAlert.active
    },
    backAction() {
       
        cc.director.loadScene("mian")
    },
    update: function (dt) {  // dt是距离上次刷新的时间 
        //console.log("帧"+dt)
      },

});